package com.leigang.java.code.design.mode.strategy;

public class Client {
    public static void main(String[] args) {
        PaymentStrategyFactory factory = new PaymentStrategyFactory();

        // 注册支付策略
        factory.registerStrategy("wechat", new WeChatPaymentStrategy());
        factory.registerStrategy("alipay", new AlipayPaymentStrategy());

        // 获取支付策略
        PaymentStrategy wechatStrategy = factory.getStrategy("wechat");
        PaymentStrategy alipayStrategy = factory.getStrategy("alipay");

        // 使用支付策略
        wechatStrategy.pay(100.0);
        alipayStrategy.pay(150.0);
    }
}
